{extend name="base"/}
{block name="resources"}
{/block}
{block name="main"}
<div class="layui-collapse ns-tips">
    <div class="layui-colla-item">
        <h2 class="layui-colla-title">操作提示</h2>
        <ul class="layui-colla-content layui-show">
            <li>默认搜索，将显示在前台搜索框，前台点击时直接作为关键词进行搜索</li>
        </ul>
    </div>
</div>
<div class="layui-form ns-form">

    <div class="layui-form-item">
        <label class="layui-form-label">默认搜索关键词：</label>
        <div class="layui-input-block ns-len-long">
            <textarea name="words" class="layui-textarea">{$default_search_words['words']}</textarea>
        </div>
    </div>

    <div class="ns-form-row">
        <button class="layui-btn ns-bg-color" lay-submit lay-filter="save">保存</button>
    </div>

</div>
{/block}

{block name="script"}
<script>
    layui.use('form', function() {
        var form = layui.form,repeat_flag=false;
        form.on('submit(save)', function(data) {
            if (repeat_flag) return;
            repeat_flag = true;

            $.ajax({
                url: ns.url("admin/config/defaultwords"),
                data: data.field,
                dataType: 'JSON',
                type: 'POST',
                success: function(res) {
                    repeat_flag = false;

                    layer.msg(res.message);
                    if (res.code == 0) {
                        location.reload();
                    }
                }
            });
        });

    });
</script>
{/block}